/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FrameWork.Audio;

/**
 *
 * @author ThanhTri
 */
public class RSAudio {
    private static RSAudio instance = null;
    public static RSAudio getRS (){
         if( instance == null){
             instance =  new RSAudio();
         }
         return instance;
    }
    private SoundEffect m_bubble;
    private SoundEffect m_Explosion;
    private SoundEffect m_Back;
    private boolean m_iEnable;
    private int m_Volume;
    private RSAudio(){
        m_Volume = 100;
        m_iEnable = true;
        m_bubble = new SoundEffect("bubble.wav");
        m_Explosion = new SoundEffect("explosion.wav");
        m_Back = new SoundEffect("back.wav");
        m_Back.load();
        m_bubble.load();
        m_Explosion.load();
    }
    public void setEnable (boolean _enable){
        m_iEnable = _enable;
    }
    public boolean getEnable (){
        return m_iEnable;
    }
    public void setVolume (int _Volume){
        m_Volume = _Volume;
    }
    public int getVolume (){
        return m_Volume;
    }
    public void PlayBack (){
        if(m_iEnable){
            m_Back.playloop(m_Volume/2);
        }
    }
    public void StopBack (){
        m_Back.Stop();
    }
    public void PlayExplosion (){
        if(m_iEnable){
            m_Explosion.PlayNoStop(m_Volume);
        }
    }
    public void PlayBubble (){
        if(m_iEnable){
            m_bubble.play(m_Volume);
        }
   }
}
